home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
basic
/
mildred
/
mildred.lha
/
lha
/
SplitTests.lha
/
SpeedTest2.ascii
< prev
next >
Wrap
Text File
|
2000-02-23
|
4KB
|
162 lines
WBStartup
#Objects=14
MReserveShapes #Objects+1
.init
InitBank 0,1280*512,$10000
CludgeBitMap 0,1280,512,8,Bank(0)
InitPalette 0,256
LoadBitMap 0,"Pic.128",0
MBitmap 0,1280,960
MBitmapWindow 0,1,0,960-512,1280,512
MPlanar16ToBitmap 1,Bank(0),1280,512,1280,512
MBitmap 2,1280,960
MBlockScroll 0,0,1280,960,0,0,0 ; Make backup
InitBank 0,320*240,$10002
CludgeBitMap 0,320,240,8,Bank(0)
InitBank 1,320*240,$10002
CludgeBitMap 1,320,240,8,Bank(1)
Screen 0,0,0,320,240,8,0,"Game",0,0,0
ShowPalette 0
.offsets
MBitmap 1,320,240
NEWTYPE.OffsetList
LineWidth.w
X1Offset.w
X2Offset.w
SourceModuloOffset.w
End NEWTYPE
Dim leftrows1.OffsetList(40)
Dim leftrows2.OffsetList(40)
Dim rightrows1.OffsetList(40)
Dim rightrows2.OffsetList(40)
leftrows1(0)\LineWidth=64-24,0,0,0
leftrows2(0)\LineWidth=64,0,0,0
rightrows1(0)\LineWidth=1,0,0,0
rightrows2(0)\LineWidth=24,0,0,0
For y=1 To 39
leftrows1(y)\LineWidth=64-24-y
leftrows1(y)\X1Offset=0
leftrows1(y)\X2Offset=0
leftrows1(y)\SourceModuloOffset=0
leftrows2(y)\LineWidth=64-y
leftrows2(y)\X1Offset=0
leftrows2(y)\X2Offset=0
leftrows2(y)\SourceModuloOffset=0
rightrows1(y)\LineWidth=y+1
rightrows1(y)\X1Offset=-1
rightrows1(y)\X2Offset=-1
rightrows1(y)\SourceModuloOffset=0
rightrows2(y)\LineWidth=24+y
rightrows2(y)\X1Offset=-1
rightrows2(y)\X2Offset=-1
rightrows2(y)\SourceModuloOffset=0
Next
.setup
Mc2pWindow 0,224,80,1280,320,240
Mc2pWindow 1,96,80,1280,320,240
Mc2pWindow 2,96,80,320,320,240
Mc2pWindow 3,128,80,320,320,240
Mc2pWindow 4,64,40,1280,320,240
Mc2pWindow 5,64,40,320,320,240
mousemult.q=1070/320
its.l=0
buf.b=0
Mc2p 1,MBitmapPtr(0,700,0),MGenericPtr(224 LSR 3,0,Bank(0),40)
Mc2p 1,MBitmapPtr(0,700,0),MGenericPtr(224 LSR 3,0,Bank(1),40)
MZoom 0,0,12,12,0,160,96,80,False,0
Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(0),40)
Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(1),40)
Use BitMap 0 : Line 319-8,0,320-96+8,79,0
Use BitMap 1 : Line 319-8,0,320-96+8,79,0
;Set up movement table
.table
MQueue 0,#Objects
NEWTYPE.xy
x.w
y.w
End NEWTYPE
MParticleMode 0
Dim xy.xy(#Objects)
Dim direction.xy(#Objects)
MAutoCookie On
MUseBitmap 0
For obj=1 To #Objects
MGetaShape obj,Rnd(1280-64),760+Rnd(200-64),64,64
xy(obj)\x=Rnd(1280-96)+16
xy(obj)\y=Rnd(960-96)+16
Repeat
direction(obj)\x=Rnd(12)-6
Until direction(obj)\x<>0
Repeat
direction(obj)\y=Rnd(12)-6
Until direction(obj)\y<>0
Next obj
MHandle 0,32,32
mag.q=12
ShowBitMap 1-buf
VWait
ResetTimer
.loop
Repeat
MUseBitmap 0
MAddToParticles &xy(1)\x,#Objects,&direction(1)\x
MReboundParticles &xy(1)\x,#Objects,&direction(1)\x,48
For obj=1 To #Objects
MQBlit obj,xy(obj)\x,xy(obj)\y ; Stencil-cut blit and add to queue
Next obj
MUseBitmap 1
player1x=SMouseX*mousemult
player1y=SMouseY*mousemult
player2x=(1280-238)-player1x
player2y=(960-160)-player1y
;player2x=player1x
;player2y=player1y
Mc2p 0,MBitmapPtr(player1x,player1y,0),Bank(buf)
Mc2p 1,MBitmapPtr(player1x,player1y+80,0),MGenericPtr(0,80,Bank(buf),40)
Mc2p 0,MBitmapPtr(player2x,player2y+80,0),MGenericPtr(96 LSR 3,160,Bank(buf),40)
Mc2p 1,MBitmapPtr(player2x+128,player2y,0),MGenericPtr(224 LSR 3,80,Bank(buf),40)
MScroll player1x+96+64,player1y+80,64,40,96+64,80,0,&leftrows1(0)
MScroll player1x+96,player1y+80+40,64,40,96,80+40,0,&leftrows2(0)
MScroll player2x+128-24,player2y,64,40,224-24,80,0,&rightrows2(0)
MScroll player2x+64,player2y+40,64,40,96+64,80+40,0,&rightrows1(0)
Mc2p 5,MBitmapPtr(96,80+40,1),MGenericPtr(96 LSR 3,80+40,Bank(buf),40)
Mc2p 5,MBitmapPtr(96+64,80,1),MGenericPtr((96+64) LSR 3,80,Bank(buf),40)
Mc2p 4,MBitmapPtr(player1x+96,player1y+80,0),MGenericPtr(96 LSR 3,80,Bank(buf),40)
Mc2p 4,MBitmapPtr(player2x+64,player2y+40,0),MGenericPtr(160 LSR 3,80+40,Bank(buf),40)
;MZoom player1x,player1y,mag,mag,0,160,96,80,False,0
;Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(buf),40)
its+1
ShowBitMap buf
; VWait
buf=1-buf
If Joyb(0)=1 Then mag-0.1
If Joyb(0)=2 Then mag+0.1
MUnQueue 0,2
Until Joyb(0)=3
;Report
.report
t=Timer
t=Max(t,1)
its=Max(its,1)
a.q=50.0/(t/its)
WBenchToFront_
WbToScreen 1
Window 2,16,16,300,40,0,"Test results",1,0
WindowOutput 2
NPrint a," frames per second"
NPrint " "
NPrint "Press mouse/joy button..."
VWait 20
Repeat
Until Joyb(0)<>0 OR Joyb(1)<>0
End